<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景图</title>
    <style>
        #box{
            width: 100%;
            height: 500px;
            background-color: #33ccff;
            background-image: url("iamge/miku.jpg");
            background-size: 300px;
            /* contain -> 包含，容纳 -> 所有部分都在容器内部 */
            background-size: contain; 
            /* cover -> 覆盖 -> 盖住容器的所有部分 */
            background-size: cover;
            background-repeat: no-repeat;
            background-position: 50% 50%;
        }
    </style>
</head>
<body>
    <div id="box"></div>
</body>
</html>